package com.Test;

import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidPooledConnection;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import com.mchange.v2.c3p0.DataSources;
import org.junit.Test;

import java.beans.PropertyVetoException;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ResourceBundle;

public class PoolTest {
    @Test
    public void T1() throws PropertyVetoException, SQLException {
        ResourceBundle jdbc = ResourceBundle.getBundle("jdbc");
        ComboPooledDataSource c3p0 = new ComboPooledDataSource();
        c3p0.setDriverClass(jdbc.getString("jdbc.driver"));
        c3p0.setDriverClass(jdbc.getString("jdbc.url"));
        c3p0.setDriverClass(jdbc.getString("jdbc.username"));
        c3p0.setDriverClass(jdbc.getString("jdbc.password"));
        Connection connection = c3p0.getConnection();
        System.out.println(connection);
    }
    @Test
    public void druid() throws SQLException {
        ResourceBundle jdbc = ResourceBundle.getBundle("jdbc");
        DruidDataSource druid=new DruidDataSource();
        druid.setDriverClassName(jdbc.getString("jdbc.driver"));
        druid.setUrl(jdbc.getString("jdbc.url"));
        druid.setUsername(jdbc.getString("jdbc.username"));
        druid.setPassword(jdbc.getString("jdbc.password"));
        DruidPooledConnection connection = druid.getConnection();
        System.out.println(connection);
    }
}
